/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vista;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;

/**
 * 
 * @author Teledhil
 */
public class PieChart extends JPanel {
	public PieChart() {

		// JPanel panel = new JPanel();
		super();

		DefaultPieDataset dataset = new DefaultPieDataset();
		dataset.setValue("Section 1", 46.7);
		dataset.setValue("Section 2", 56.5);
		dataset.setValue("Section 3", 43.3);
		dataset.setValue("Section 4", 11.1);

		JFreeChart chart = ChartFactory.createPieChart3D("Chart 3", dataset,
				false, false, false);
		PiePlot3D plot = (PiePlot3D) chart.getPlot();
		plot.setForegroundAlpha(0.6f);
		plot.setCircular(true);

		this.add(new ChartPanel(chart));
		// this.setPreferredSize(new Dimension(300, 200));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Cargando tarta...");
		PieChart pieChart = new PieChart();
		JFrame frame = new JFrame("PieChart");
		frame.add(pieChart);
		frame.pack();
		frame.setVisible(true);
		System.out.println("La tarta es mentira!");
		
		
	}
}
